/// @author: cairuoyu
/// @homepage: http://cairuoyu.com
/// @github: https://github.com/cairuoyu/flutter_admin
/// @date: 2021/6/21
/// @version: 1.0
/// @description:

import 'package:cry/model/response_body_api.dart';
import 'package:cry/utils/http_util.dart';
import 'package:flutter_admin/models/menu.dart';

class MenuApi {
  static Future<ResponseBodyApi> listAuth(data) async {
    ResponseBodyApi responseBodyApi = ResponseBodyApi();
    List<Map<String, dynamic>> menuList = [];
    Map<String, dynamic> roleMap = {
      "id": "1",
      "url": "/roleList",
      "icon": "role",
      "nameEn": "roleList",
      "name": "角色管理",
      "orderBy": 1
    };
    Map<String, dynamic> dataGridMap = {
      "id": "2",
      "url": "/dataGridMap",
      "icon": "role",
      "nameEn": "dataGridMap",
      "name": "data_grid",
      "orderBy": 2
    };
    menuList.add(roleMap);
    menuList.add(dataGridMap);
    responseBodyApi.data = menuList;
    responseBodyApi.code = '0';
    responseBodyApi.success = true;
    return responseBodyApi;
//    return await HttpUtil.post('/menu/listAuth', data: data);
  }

  static Future<ResponseBodyApi> list(data) async {
    ResponseBodyApi responseBodyApi = await HttpUtil.post('/menu/list', data: data);
    return responseBodyApi;
  }

  static Future<ResponseBodyApi> saveOrUpdate(data) async {
    ResponseBodyApi responseBodyApi = await HttpUtil.post('/menu/saveOrUpdate', data: data);
    return responseBodyApi;
  }

  static removeByIds(data) {
    return HttpUtil.post('/menu/removeByIds', data: data);
  }
}
